<?php

declare(strict_types=1);

namespace app\chat\model;

use sheep\model\Common;

class User extends Common
{
    protected $name = 'chat_user';

    // 自动数据类型转换
    protected $type = [
        'last_time' => 'timestamp',
    ];

    public function customer()
    {
        return $this->morphMany(\app\chat\model\Record::class, ['sender_identify', 'sender_id'], 'customer');
    }

    public function user() 
    {
        return $this->belongsTo(\sheep\model\user\User::class, 'auth_id');
    }


    public function customerService() 
    {
        return $this->belongsTo(\app\chat\model\CustomerService::class, 'customer_service_id');
    }
}
